package cn.gxa.j229.bug.finance.service.contant.impl;

import cn.gxa.j229.bug.finance.mapper.AdMapper;
import cn.gxa.j229.bug.finance.mapper.EssayMapper;
import cn.gxa.j229.bug.finance.pojo.Ad;
import cn.gxa.j229.bug.finance.pojo.Essay;
import cn.gxa.j229.bug.finance.service.contant.EssayService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @author Jun
 * @version 1.0
 * @date 2020/9/25 10:45
 */

@Service("essayService")
public class EssayServiceImpl implements EssayService {

    @Resource
    private EssayMapper essayMapper = null;

    @Override
    public int delete(Integer id) {
        return essayMapper.delete(id);
    }

    @Override
    public int insert(Essay essay) {
        return essayMapper.insert(essay);
    }

    @Override
    public List<Map<String, Object>> selectById(Integer id) {
        return essayMapper.selectById(id);
    }

    @Override
    public List<Map<String, Object>> selectByTitle(String title) {
        return essayMapper.selectByTitle(title);
    }


    @Override
    public List<Map<String, Object>> selectByType(String type) {
        return essayMapper.selectByType(type);
    }

    @Override
    public List<Map<String, Object>> selectByState(Integer state) {
        return essayMapper.selectByState(state);
    }

    @Override
    public List<Map<String, Object>> selectEssayByPage(Essay essay) {
        essay.setLimit((essay.getLimit() - 1) * essay.getPage());
        return essayMapper.selectByPage(essay);
    }

    @Override
    public int selectByPageCount(Essay essay) {
        return essayMapper.selectByPageCount(essay);
    }

    @Override
    public List<Map<String,Object>> selectCount() {
        return  essayMapper.selectCount();
    }
    @Override
    public int update(Essay essay) {
        return essayMapper.update(essay);
    }

    @Override
    public List<Map<String, Object>> selectAllType( ) {
        return essayMapper.selectAllType();
    }
}
